//将标准时间戳转化为周几
ticketHub.filter("week",function(){                    
	return function(input){
		if(input){
			var dayofweek = new Date(input).getDay();
			if(dayofweek=="0"){
				return "周日";
			}
			if(dayofweek=="1"){
				return "周一";
			}
			if(dayofweek=="2"){
				return "周二";
			}
			if(dayofweek=="3"){
				return "周三";
			}
			if(dayofweek=="4"){
				return "周四";
			}
			if(dayofweek=="5"){
				return "周五";
			}
			if(dayofweek=="6"){
				return "周六";
			}		
		}
	}
});
//将空转化为未知；
ticketHub.filter("empty",function(){
	return function(input){
		if(input==""){
			return "未知";
		}
	}
});
//转化供应商ID
ticketHub.filter("supplierId",function(){
	return function(input){
		if(input==null || input==undefined) return "";
		switch(input.toString()){
			case "JHAD": return "京杭";
			case "TDXD": return "天地行国内";
			case "TDXI": return "天地行国际";
			case "PSSA": return "PSS";
			default: return input;
		}
	}
});
//将空数组转化为否；
ticketHub.filter("arrEmpty",function(){
	return function(input){
		if(input.length==0){
			return "否";
		}
	}
});
//将undefined转化为未知
ticketHub.filter("undefined",function(){
	return function(input){
		if(input==undefined){
			return "未知";
		}
	}
});
//将undefined转化为空
ticketHub.filter("undefinedToEmpty",function(){
	return function(input){
		if(input==undefined){
			return "";
		}
	}
});
//经停
ticketHub.filter("stopCount",function(){
	return function(input){
		if(input=="0"){
			return "否";
		}else{
			return "是";
		}
	}
});
//舱位等级
ticketHub.filter("cabinRank",function(){
	return function(input){
		if(input=="Y"){
			return "经济舱";
		}if(input=="C"){
			return "商务舱";
		}if(input=="F"){
			return "头等舱";
		}else{
			return "未知";
		}
	}
});
//舱位
ticketHub.filter("cabinCode",function(){
	return function(input){
		if(input=="0"){
			return "否";
		}else{
			return "是";
		}
	}
});

//中转
ticketHub.filter("zhongZhuan",function(){
	return function(input){
		var input = input.split(",");
		var length = input.length;
		var segTimes = 0;
		for(var i=0;i<length;i++){
			var seg = (input[i].split("-")[1])-0;
			segTimes += seg;
		}
		if(length==1){
			if(segTimes==1){
				return "直达";
			}else if(segTimes==2){
				return "一次中转";
			}else if(segTimes>2){
				return "多次中转";
			}
		}else if(length==2){
			if(segTimes==2){
				return "直达";
			}else if(segTimes==3){
				return "一次中转";
			}else if(segTimes>3){
				return "多次中转";
			}
		}else{
			return "";
		}				
	}
});
//2012-12-12 12:12=>12:12
ticketHub.filter("hm",function(){
	return function(input){
		return input.slice(-5);
	}
});
//2012-12-12 12:12=>12-12
ticketHub.filter("yMd",function(){
	return function(input){
		return input.slice(5,10);
	}
});
//2012-12-12 12:12=>new Date();
ticketHub.filter("sjc",function(){
	return function(input){
		return new Date(input);
	}
});
//将时间的差值ms数转化为hh:mm;
ticketHub.filter("timeDuring",function(){
	return function(input){
		var hh =  Math.floor(input/1000/60/60);
		var mm =  Math.floor(input/1000/60%60);
		return hh+"h"+mm+"m";
	}
});
//将时间的差值min数转化为hh:mm;
ticketHub.filter("timeDuring2",function(){
	return function(input){
		var hh =  Math.floor(input/60);
		var mm =  Math.floor(input%60);
		return hh+"h"+mm+"m";
	}
});
//将时间的差值ms数转化为dd;
ticketHub.filter("dayDuring",function(){
	return function(input){
		var dd =  Math.floor(input/1000/60/60/24);		
		return dd;
	}
});
//改签订单状态
ticketHub.filter("endorseOrderStatus",function(){
	return function(input){
		if(input=="waiting_for_review"){
			return "待审核";
		}if(input=="review_success"){
			return "审核通过";   
		}if(input=="waiting_for_process"){
			return "待改签处理";   
		}if(input=="gathering_success"){
			return "改签成功";   
		}if(input=="cancel"){
			return "取消";   
		}if(input=="review_fail"){
			return "审核未通过";   
		}if(input=="returned"){
			return "改签退回";   
		}
		
	}
});
//改签类型
ticketHub.filter("endorseType",function(){
	return function(input){
		if(input=="RESCHEDULE"){
			return "仅改期";
		}if(input=="UPGRADE"){
			return "升舱";   
		}if(input=="RESCHEDULE_UPGRADE"){
			return "升舱并改期";   
		}
	}
});
//订单状态
ticketHub.filter("orderStatus",function(){
	return function(input){
		if(input=="WAIT_PAY"){
			return "待支付";
		}if(input=="PAYING"){
			return "支付中";   
		}if(input=="WAIT_AUDIT"){
			return "待审核";   
		}if(input=="AUDIT_FALSE"){
			return "审核失败";   
		}if(input=="CANCELED"){
			return "已取消";   
		}if(input=="WAIT_ISSUE"){
			return "待出票";   
		}if(input=="PAY_FALSE"){
			return "支付失败";   
		}if(input=="ISSUE_FALSE"){
			return "出票失败";   
		}if(input=="ISSUED"){
			return "已出票";   
		}if(input=="ISSUED_SUSPEND"){
			return "已出票(挂起)";   
		}if(input=="ENDORSE_WAIT_AUDIT"){
			return "改签待审核";   
		}if(input=="ENDORSE_AUDIT_SUCCESS"){
			return "改签审核成功";   
		}if(input=="ENDORSE_AUDIT_FALSE"){
			return "改签审核失败";   
		}if(input=="WAIT_REFUND"){
			return "待退票";   
		}if(input=="REFUND_FALSE"){
			return "退票失败";   
		}if(input=="CANCEL_REFUND"){
			return "取消退票";   
		}if(input=="REFUND_FINISH"){
			return "退票成功";   
		}if(input=="REFUND_WAIT_AUDIT"){
			return "退票待审核";   
		}if(input=="REFUND_AUDIT_FALSE"){
			return "退票审核失败";   
		}if(input=="CANCEL_ENDORSE"){
			return "取消改签";   
		}if(input=="WAIT_ENDORSE"){
			return "待改签";   
		}if(input=="ENDORSE_FALSE"){
			return "改签失败";   
		}if(input=="ENDORSE_FINISH"){
			return "改签成功";   
		}else{
			return "-";
		}
	}
});
//乘客类型
ticketHub.filter("passengerType",function(){
	return function(input){
		if(input=="ADU"){
			return "成人";
		}if(input=="CHD"){
			return "儿童";   
		}if(input=="INF"){
			return "婴儿";   
		}
	}
});
//乘客性别
ticketHub.filter("gender",function(){
	return function(input){
		if(input=="1"){
			return "男";
		}if(input=="2"){
			return "女";   
		}
	}
});
//证件类型
ticketHub.filter("credentialType",function(){
	return function(input){
		if(input=="NI"){
			return "身份证";
		}if(input=="PP"){
			return "护照";   
		}if(input=="ID"){
			return "其它";   
		}
	}
});
//证件类型2
ticketHub.filter("credentialType2",function(){
	return function(input){
		if(input=="1"){
			return "身份证";
		}if(input=="2"){
			return "护照";   
		}if(input=="99"){
			return "其它";   
		}
	}
});
//投保人与被保人关系
ticketHub.filter("relationToPolicyHolder",function(){
	return function(input){
		if(input=="0"){
			return "本人";
		}if(input=="1"){
			return "夫妻";   
		}if(input=="2"){
			return "父母";   
		}if(input=="3"){
			return "子女";   
		}if(input=="4"){
			return "孙子女";   
		}if(input=="5"){
			return "祖父母";   
		}if(input=="99"){
			return "其它";   
		}
	}
});
//支付方式
ticketHub.filter("payType",function(){
	return function(input){
		if(input=="ACCOUNTPAY"){
			return "账户支付";
		}if(input=="ALIPAY"){
			return "支付宝";   
		}if(input=="TENPAY"){
			return "财付通";   
		}if(input=="CHINAPNR"){
			return "汇付";   
		}if(input=="E_BANK"){
			return "网银(暂不支持)";   
		}if(input=="AIRPLUS"){
			return "AirPlus";   
		}else{
			return "-";
		}
	}
});
//低开
ticketHub.filter("lowOpen",function(){
	return function(input){
		if(input==true){
			return "是";
		}else{
			return "否";
		}
	}
});
//将负数转化为正数
ticketHub.filter("removeF",function(){
	return function(input){
		if(input){
			var input  = input*-1;
			return input;
		}
	}
});